package com.base.web.restful.controller;

import com.base.web.core.common.JsonResult;
import com.base.web.core.util.kafka.KafkaProducer;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 * Description:
 *
 * @Author: RenTie
 * @Date: 2018-08-20 14:45
 **/
@Api("kafka测试")
@RestController
@RequestMapping("/kafka")
public class KafkaController {

    private Logger logger = LoggerFactory.getLogger(KafkaController.class);

    @Autowired
    private KafkaProducer kafkaProducer;

    @ApiOperation(value="kafka推送消息", notes="获取对象列表")
    @GetMapping(value = "/send/{message}")
    public JsonResult send(@ApiParam(name = "message",value = "消息内容") @PathVariable("message")String message){
        kafkaProducer.send("kafka.tut",message);
        return JsonResult.success(message);
    }
}
